
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":"
            + request.getServerPort() + path + "/";
%>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>网站后台管理系统HTML模板--模板之家 www.cssmoban.com</title>
    <link href="<%=basePath%>jsp/backstage/css/style.css" rel="stylesheet"
          type="text/css"/>
    <script type="text/javascript" src="<%=basePath%>jsp/backstage/js/jquery.js"></script>
    <script type="text/javascript">
        //用于弹出窗口，将服务器返回的数据提交，本处用于账户提交后的状态
        function alert_myMessage() {
            var message = "${requestScope.myMessage}";
            if (message != "") {
                alert(message);
            }
        }

        //页面加载后起作用
        $(document).ready(function () {
            alert_myMessage();//调用上面的函数，用于弹出窗口

        });
    </script>

</head>
<body>
    <div class="place">
        <span>位置：</span>
        <ul class="placeul">
            <li><a href="#">首页</a></li>
            <li><a href="<%=basePath%>admin/adminmanage/adminmanage">账户管理</a></li>
            <li><a href="#">账户添加</a></li>
        </ul>
    </div>
    <div class="formbody">
        <div class="formtitle"><span>管理账户添加</span></div>
        <form action="<%=basePath%>backstage/adminmanage/doAdd">
            <ul class="forminfo">
                <li>
                    <label>*账户名</label>
                    <input name="username" type="text" class="dfinput" value="" required>
                </li>

                <li>
                    <label>*网名</label>
                    <input name="name" type="text" class="dfinput" value="" required>
                </li>
                <li>
                    <label>*性别</label>
<%--                    <input name="sex" type="text" class="dfinput" value="" required>--%>
                    <select name="sex" required style="height: 32px;border: 1px solid #333">
                        <option selected value="1">男</option>
                        <option value="2">女</option>
                    </select>
                </li>
                <li>
                    <label>*是否锁定</label>
<%--                    <input name="unLocked" type="text" class="dfinput" value="" required>--%>
                    <select name="unLocked" required style="height: 32px;border: 1px solid #333">
                        <option  value="true" selected>锁定</option>
                        <option value="false">不锁定</option>
                    </select>
                </li>
                <li>
                    <label>*密码</label>
                    <input name="password" type="password" class="dfinput" value="" required>
                </li>
                <li>
                    <label>*确认密码</label>
                    <input name="password2" type="password" class="dfinput">
                </li>
                <li>

                    <input name="submit" type="submit" class="btn" value="确认保存">
                </li>
            </ul>
        </form>
    </div>
    <script>
        $('input[name="submit"]').click(()=>{


            let password=$('input[name="password"]').val()
            let password2=$('input[name="password2"]').val()
            // if (password==""){
            //     confirm("密码不能为空！")
            //     return false
            // }

            if (password!==password2){
                confirm("两次密码输入不一致！")
                return false
            }
            if (password!=''&&password2!=''){
                let re =/^(?=.*[a-z])(?=.*\d)[^]{8,16}$/;
                let result =  re.test(password);
                if (!result){
                    confirm("密码必须包含数字,字母,且不少于8位！")
                    return false
                }
            }


        })
        let msg="${requestScope.alert_msg}"
        if (msg!=''){
            alert(msg)

        }

    </script>
</body>
</html>
